package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInAccountingQueryBcInvoice;
import com.ims.core.doc.service.ITInAccountingQueryBcInvoiceService;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 区块链发票报账单查询Controller
 *
 * @author IMS
 * @date 2024-12-03
 */
@RestController
@RequestMapping("/doc/inaccountingquerybcinvoice")
public class TInAccountingQueryBcInvoiceController extends BaseController
{
    @Autowired
    private ITInAccountingQueryBcInvoiceService tInAccountingQueryBcInvoiceService;

    /**
     * 查询区块链发票报账单查询列表
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInAccountingQueryBcInvoice tInAccountingQueryBcInvoice)
    {
        startPage();
        List<TInAccountingQueryBcInvoice> list = tInAccountingQueryBcInvoiceService.selectTInAccountingQueryBcInvoiceList(tInAccountingQueryBcInvoice);
        return getDataTable(list);
    }

    /**
     * 导出区块链发票报账单查询列表
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:export')")
    @Log(title = "区块链发票报账单查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInAccountingQueryBcInvoice tInAccountingQueryBcInvoice)
    {
        List<TInAccountingQueryBcInvoice> list = tInAccountingQueryBcInvoiceService.selectTInAccountingQueryBcInvoiceList(tInAccountingQueryBcInvoice);
        ExcelUtil<TInAccountingQueryBcInvoice> util = new ExcelUtil<TInAccountingQueryBcInvoice>(TInAccountingQueryBcInvoice.class);
        util.exportExcel(response, list, "区块链发票报账单查询数据");
    }

    /**
     * 获取区块链发票报账单查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInAccountingQueryBcInvoiceService.selectTInAccountingQueryBcInvoiceById(id));
    }

    /**
     * 新增区块链发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:add')")
    @Log(title = "区块链发票报账单查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInAccountingQueryBcInvoice tInAccountingQueryBcInvoice)
    {
        return toAjax(tInAccountingQueryBcInvoiceService.insertTInAccountingQueryBcInvoice(tInAccountingQueryBcInvoice));
    }

    /**
     * 修改区块链发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:edit')")
    @Log(title = "区块链发票报账单查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInAccountingQueryBcInvoice tInAccountingQueryBcInvoice)
    {
        return toAjax(tInAccountingQueryBcInvoiceService.updateTInAccountingQueryBcInvoice(tInAccountingQueryBcInvoice));
    }

    /**
     * 删除区块链发票报账单查询
     */
    @PreAuthorize("@ss.hasPermi('doc:inaccountingquerybcinvoice:remove')")
    @Log(title = "区块链发票报账单查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInAccountingQueryBcInvoiceService.deleteTInAccountingQueryBcInvoiceByIds(ids));
    }
}
